//
//  AVFoundation+Ex.swift
//  Maze24
//
//  Created by Mars on 2020/12/21.
//

import AVFoundation

extension AVAudioPlayer {
  func play(_ filename: String) {
    let path = Bundle.main.path(forResource: filename, ofType: nil)!
    let url = URL(fileURLWithPath: path)
    
    let player = try! AVAudioPlayer(contentsOf: url)
    player.prepareToPlay()
    player.play()
  }
}
